package com.garden.springcloud.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.garden.springcloud.project.entity.User;
import com.garden.springcloud.project.query.UserQuery;
import com.garden.springcloud.project.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping(value = "getUser")
    public List<User> getUser() {
        return userService.getUser();
    }

    @GetMapping(value = "getList")
    public IPage getLi(UserQuery query) {
        return userService.getUsers(query);
    }

    @GetMapping(value = "getValue")
    public String getValue() {
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "success value";
    }
}
